{extend name="./oscshop/admin/view/public/base.html" /}
{block name="content"}
<div class="page-header">
	<h1>	
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb2}
		</small>
	</h1>
</div>
		
<table class="table table-striped table-bordered table-hover search-form">
	<thead>
		
		<th><input name="username" type="text" placeholder="输入会员用户名" value="{:input('param.username')}" /></th>		
		
		<th><input name="order_sn" type="text" placeholder="输入订单号" value="{:input('param.order_sn')}" /></th>	
		<th>    				
			<select name="status">
				<option value="">-所有状态-</option>
				<?php $status=input('param.status'); ?>
				<option {if condition="isset($status) and (1 eq $status)"} selected="selected"{/if} value="1">待处理</option>
				<option {if condition="isset($status) and (2 eq $status)"} selected="selected"{/if} value="2">已同意</option>			
				<option {if condition="isset($status) and (3 eq $status)"} selected="selected"{/if} value="3">拒绝</option>		
			</select>
		</th>
		
		<th>
			<a class="btn btn-primary" href="javascript:;" id="search" url="{:url('RefundBackend/index')}">查询</a>
		</th>
	</thead>
</table>	
	
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<th>订单号</th>						
						<th>订单类型</th> 
						
						<th>用户名</th> 
						<th>订单金额</th> 
						<th>退款金额</th> 
						<th>类型</th>
											
						<th>申请时间</th>							
						<th>状态</th>	
						<th>处理人</th>					
						<th>操作</th>	
					</tr>
				</thead>
				<tbody>
						{volist name="list" id="d" empty="$empty"}
						<tr>						
							<td>{$d.order_sn}</td>							
							<td>{:get_goods_type_info(array('type'=>$d['type']),'type')}</td>
						
							<td>{$d.username}</td>
							<td>{$d.order_amount}</td>
							<td>{$d.refund_amount}</td>
							<td>
								{switch name="d.refund_type"}
									{case value="1"}退款{/case}
									{case value="2"}退款退货{/case}
								{/switch}
							</td>
							
							<td>{$d.add_time|date='Y-m-d H:i:s',###}</td>
							<td>
								{switch name="d.status"}
									{case value="1"}待处理{/case}
									{case value="2"}已同意{/case}
									{case value="3"}拒绝{/case}
								{/switch}
							</td>
							<td>
								{$d.admin_name|default='无'}
							</td>
							<td>							
								<a href="{:url('RefundBackend/refund',array('id'=>$d['refund_id']))}" class="btn btn-xs btn-info">
									<i class="fa fa-eye bigger-120"></i>
								</a>
								<a href="{:url('RefundBackend/del',array('id'=>$d['refund_id']))}" class="delete btn btn-xs btn-danger">
									<i class="fa fa-trash bigger-120"></i>
								</a>
							</td>
						</tr>
						{/volist}	
						
						<tr>
							<td colspan="20" class="page">{$list->render()}</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
{/block}
{block name="javascript"}
<script>	
$(function(){
   $("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });	
});
</script>
{/block}